Safe Structural Conformance for Java
نویسندگان
چکیده
In Java, an interface specifies public abstract methods and associated public constants. Conformance of a class to an interface is by name. We propose to allow structural conformance to interfaces as well: Any class that provides an implementation for each method in an interface conforms structurally to the interface, and any instance of the class can be used where a value of the interface type is expected. We argue that structural conformance results in a major gain in flexibility in situations that require retroactive abstraction over types. Our extension comes almost for free. No additional syntax and only minor modifications to the Java compiler and virtual machine are required. Our extension is type-safe: a cast-free program that compiles without errors will not have any type errors at run time, and it is conservative: existing Java programs compile and run in the same manner as under the original language definition. Finally, our extension works well with recent extensions such as the Java Distributed Object Model. We have implemented our extension of Java with structural interface conformance by modifying the Java Developers Kit 1.0.2 source release for Solaris. We have also created a test suite for the extension.
منابع مشابه
Checking and Measuring the Architectural Structural Conformance of Object-Oriented Systems
The benefits of architectural analyses are only achieved if one can guarantee that the implementation conforms to the architecture. We propose an approach for checking and measuring the structural conformance of a software system’s implementation to its execution architecture. In contrast to existing approaches, our approach uses static analyses, and works with existing Java-like programming la...
متن کاملChecking and Measuring the Architectural Structural Conformance of Object-Oriented Systems1
The benefits of architectural analyses are only achieved if one can guarantee that the implementation conforms to the architecture. We propose an approach for checking and measuring the structural conformance of a software system’s implementation to its execution architecture. In contrast to existing approaches, our approach uses static analyses, and works with existing Java-like programming la...
متن کاملImplementing Dynamic Language Features in Java Using Dynamic Code Generation
Compared to dynamic object-oriented languages like CommonLisp or Smalltalk, Java has a fairly simple and restrictive object and type system. Some of the key differences between Java and these other languages is that they offer structural conformance, automatic delegation, and dynamic mixins. When such constructs are needed in a language like Java, they are usually expressed in terms of standard...
متن کاملChecking the Conformance of Java Classes Against Algebraic Specifications
We present and evaluate an approach for the run-time conformance checking of Java classes against property-driven algebraic specifications. Our proposal consists in determining, at run-time, whether the classes subject to analysis behave as required by the specification. The key idea is to reduce the conformance checking problem to the runtime monitoring of contract-annotated classes, a process...
متن کاملSafe uniform proxies for Java
The proxy abstraction has a long-lasting tradition in object-oriented programming. From design patterns to inherent programming language support, from remote method invocations to simple forms of behavioral reflection – incarnations as well as applications of proxies are innumerable. Since version 1.3, Java supports the concept of dynamic proxy. Such an object conforms to a set of types specifi...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Comput. J.
دوره 43 شماره
صفحات -
تاریخ انتشار 2000